using UnityEngine;

public class ShowController : MonoBehaviour
{
	public static ShowController instance;

	public Transform campointTra;

	public GameObject[] planeshow;

	private ShowTime curshowtime;

	private int curpoint;

	private GameObject preobj;

	private int curplane;

	private GameObject curobj;

	public GameObject islandobj;

	public ShowtimePoint pointshow;

	public void enable()
	{
		if (instance == null)
		{
			instance = this;
		}
		if (curobj == null)
		{
			curobj = base.gameObject;
		}
		UnityVersionUtil.SetActiveRecursive(curobj, state: true);
		if (GlobalInf.CurrentQuality > Quality.Low && islandobj == null)
		{
			islandobj = (UnityEngine.Object.Instantiate(Resources.Load("Island/showisland")) as GameObject);
			islandobj.transform.parent = base.transform;
			islandobj.transform.localPosition = Vector3.zero;
			islandobj.transform.localRotation = Quaternion.Euler(Vector3.zero);
		}
	}

	public void showplane(int pindex)
	{
		GameObject gameObject = UnityEngine.Object.Instantiate(planeshow[pindex]) as GameObject;
		gameObject.transform.parent = base.transform;
		if (curshowtime != null)
		{
			curpoint = curshowtime.curpoint;
			preobj = curshowtime.gameObject;
		}
		else
		{
			curpoint = 0;
			preobj = null;
		}
		curshowtime = gameObject.GetComponent<ShowTime>();
		curshowtime.init_info((curpoint + 1) % 6, campointTra);
		pointshow.setangleflag = true;
		pointshow.angletime = 0f;
		if (preobj != null)
		{
			UnityEngine.Object.Destroy(preobj, 0.8f);
		}
	}

	public void disable()
	{
		if (instance != null)
		{
			instance = null;
		}
		if (curobj != null)
		{
			UnityVersionUtil.SetActiveRecursive(curobj, state: false);
		}
	}
}
